<?
session_start();
include('conn.php');
//$qry1 = "SELECT * from expensemast where status=0 order by exptranid desc";//left join customermast t2 on t1.custid = t2.custid
//$qry1 = "SELECT opbaltranid,opbaldate,custid,trancat,amtpaid,comment,entrydt,enteredby,status from opbalmast where status=0 order by opbaltranid desc";

$qry1 = "SELECT opbaltranid,custdesc, opbaldate,t2.custid,trancat,amtpaid,amtreceived,t2.entrydt,t2.enteredby,t2.status,comment from opbalmast t1
left join customermast t2 on t1.custid = t2.custid where t1.status=0 order by opbaltranid desc";


$qry = mysql_query($qry1);
$data = array();
$i=1;
while($rows = mysql_fetch_array($qry))
{
	$data[] = array("Sr_NO" => $i++,
        			"opbaltranid" => $rows['opbaltranid'],
					"opbaldate" => $rows['opbaldate'],
					"custid" => $rows['custid'],
					"custdesc" =>$rows['custdesc'],
					"trancat" => $rows['trancat'],
					"amtpaid"=> $rows['amtpaid'],
					"amtreceived"=> $rows['amtreceived'],
					"comment"=> $rows['comment'],
					"entrydt"=> $rows['entrydt'],
					"enteredby"=> $rows['enteredby'],
                    "status"=> $rows['status']
                    );
}
echo json_encode($data);
?>